import { FormProps, FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table/src/types/table';
import { getJulyDictItemListByTypeApi } from '/@/api/admin/julyDictItemApi';
import { getProfessionListApi } from "/@/api/website/websiteProfessionApi";





//表格显示列
export function getBasicColumns(): BasicColumn[] {
  // @ts-ignore
  return [
    {
      title: 'ID',
      dataIndex: 'trainingScheduleId',
      fixed: 'left',
      defaultHidden: true,
      width: 100,
    },
    {
      title: '班期名称',
      dataIndex: 'trainingScheduleName',
      width: 150,

    },
    {
      title: '授课专业',
      dataIndex: 'profession',
      width: 100,
    },
    {
      title: '开始授课时间',
      dataIndex: 'trainingBeginTime',
      width: 150,
      //sorter: true,
      //defaultHidden: true,
    },
    {
      title: '结课时间',
      width: 100,
      dataIndex: 'trainingEndTime',
    },
    {
      title: '班期人数',
      width: 100,
      dataIndex: 'students',
    },

  ];
}

export function getFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 150,
    baseColProps: { lg: 6, md: 24 },
    schemas: formParamSchema,
  };
}


//编辑表单
export const formParamSchema: FormSchema[] = [
  {
    field: 'trainingScheduleName',
    label: '班期名称',
    component: 'Input',
  },
  {
    field: 'professionId',
    label: '培训专业',
    component: 'ApiSelect',
    componentProps: {
      api: getProfessionListApi,
      labelField: 'professionFull',
      valueField: 'professionId',
    },
  },
];

//编辑表单
export const formSchema: FormSchema[] = [
  {
    field: 'trainingScheduleName',
    label: '班期名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'professionId',
    label: '培训专业',
    component: 'ApiSelect',
    componentProps: {
      api: getProfessionListApi,
      labelField: 'professionFull',
      valueField: 'professionId',
    },
    required: true,
  },

  {
    field: 'trainingBeginTime',
    label: '开始授课时间',
    component: 'DatePicker',

    required: true,
  },
  {
    field: 'trainingEndTime',
    label: '结课时间',
    component: 'DatePicker',

    required: true,
  },

  {
    field: 'students',
    label: '学员数量',
    component: 'InputNumber',
    defaultValue: '0',
    required: true
  },
];
